<?php
class GridConfig extends BaseModuleConfig
{
    public $RPP_COOKIE  = 'rpps';
    public $RPP_DEFAULT = 20;
    public $RPP_MAX     = 500;
    public $PAGER       = array(10, 20, 50, 100, 150, 250, 500);

    public $COOKIE_GRIDCONFIG = 'gridconfig';

    protected static $instance;

    public static function GetInstance()
    {
        return self::$instance ? self::$instance : self::$instance = new GridConfig();
    }

    public function GridConfig()
    {
        parent::__construct();
        AppConfig::GetInstance()->AddReplaceValue('url_grid', $this->URL_DEFAULT);
        AppConfig::GetInstance()->AddReplaceValue('url_grid_img', $this->URL_IMG);
    }

    public function SetRpp($view, $rpp)
    {
        Cookie::Set($this->RPP_COOKIE."[$view]", $rpp);
    }

    public function GetRpp($view)
    {
        $rpps = Cookie::Get($this->RPP_COOKIE);
        return is_set($rpps[$view], $this->RPP_DEFAULT);
    }
}
?>
